use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{mpsc, Arc};
use std::thread;

struct Foo;

struct Bar {
    foo: RefCell<Foo>,
    msg: String,
}

impl Foo {
    fn foo(&mut self, bar: &Bar) {
        println!("{}", bar.msg);
    }
}

impl Bar {
    fn new(foo: Foo) -> Self {
        Self {
            foo: RefCell::new(foo),
            msg: String::from("Baaaaaar"),
        }
    }
    fn bar(&mut self) {
        self.foo.borrow_mut().foo(self);
    }
}

fn main() {
    let mut bar = Bar::new(Foo);
    bar.bar();
}
